package com.lch.designpattern.template.jdbc.dao;

import com.lch.designpattern.template.RowMapper;
import com.lch.designpattern.template.jdbc.JdbcTemplate;

import java.sql.ResultSet;
import java.util.List;

import javax.sql.DataSource;

/**
 * @author: liuchenhui
 * @create: 2019-06-23 21:53
 **/
public class MemberDao extends JdbcTemplate {

    public MemberDao(DataSource dataSource) {
        super(dataSource);
    }

    public List<?> queryList() {
        String sql = "select * from t_member";
        return super.quertList(sql, (RowMapper<Member>) (set, rowNum) -> {
            Member m = new Member();
            m.setName("lch");
            m.setCode(200);
            m.setGander(1);
            return m;
        }, null);
    }
}
